<script type="text/javascript">

$(document).ready(function(){

$("#id_jabatan").change(function(){
$("#jabatan").val($("#id_jabatan option:selected").text());
});

});

</script>
<div class="form">
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'horizontalForm',
    'type'=>'horizontal',
	'htmlOptions'=>array('enctype' => 'multipart/form-data'),
)); ?>

     	<fieldset>
		<legend>
			<span class="required">*</span> Wajib Diisi.
		</legend>

	<?php echo $form->errorSummary($model,'Opps!!!', null,array('class'=>'alert alert-error span12')); ?>
        		
   <div class="control-group">		
			<div class="span4">

    <?php
    $superUser = User::model()->findByPk(Yii::app()->user->getId())->superuser;
    $bidang = User::model()->findByPk(Yii::app()->user->getId())->id_bidang;
    echo $superUser;
    ?>              
	
	<?php 
    if($superUser==1){
    echo $form->DropDownListRow($model,'id_bidang',CHtml::listData(Bidang::model()->findAll(), 'id', 'nama_bidang' ),array('prompt'=>'Pilih Bidang',
          'value'=>'0',
          'id'=>'bidang_id',
    )); 
    }
    else{
    ?>
    <div class="control-group ">
    <label class="control-label" for="Tugaswewenang_id_bidang">Nama Bidang</label>
    <div class="controls">
    <input  class="span2" type="text" name="id_bidang" value="<?= Bidang::model()->findByPk($bidang)->nama_bidang ?>" readonly="readonly" maxlength="100">
    </div>
    </div>
    <?php 
    echo $form->hiddenField($model,'id_bidang',array('class'=>'span2','maxlength'=>100,'value'=>$bidang));   
    }
    ?>

    <?php echo $form->textFieldRow($model,'nama_kegiatan',array('class'=>'span5','maxlength'=>200)); ?>      

    <div class="control-group">
          
                <label class="control-label">Tanggal Kegiatan</label>
                <div class="controls">
                    <?php
                    $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                        'model'=>  $model,
                        'attribute'=>'tanggal_kegiatan',
                        'id'=>'tanggal_lahir',
                        'options'=>array(
                            'dateFormat'=>'dd-mm-yy',
                            'changeMonth'=>'true',
                            'changeYear'=>'true',
                            'constrainInput'=>'false',
                            'duration'=>'fast',
                            'showAnim'=>'slide',
                        ),
                        'htmlOptions' => array("style" => "width: 100px"),
                    ));
                    ?>
                    
                
                </div>
        </div>


        <?php echo $form->textAreaRow($model,'uraian',array('rows'=>2, 'cols'=>40, 'class'=>'span5')); ?>    


        <div class="control-group">
          
                <label class="control-label">Foto</label>
                <div class="controls">
        <?php
		  $this->widget('CMultiFileUpload', array(
		     'model'=>$modelFoto,
		     'attribute'=>'foto',
		     'accept'=>'jpg|gif|png|jpeg',
		     'options'=>array(
		        // 'onFileSelect'=>'function(e, v, m){ alert("onFileSelect - "+v) }',
		        // 'afterFileSelect'=>'function(e, v, m){ alert("afterFileSelect - "+v) }',
		        // 'onFileAppend'=>'function(e, v, m){ alert("onFileAppend - "+v) }',
		        // 'afterFileAppend'=>'function(e, v, m){ alert("afterFileAppend - "+v) }',
		        // 'onFileRemove'=>'function(e, v, m){ alert("onFileRemove - "+v) }',
		        // 'afterFileRemove'=>'function(e, v, m){ alert("afterFileRemove - "+v) }',
		     ),
		     'denied'=>'File is not allowed',
		     'max'=>20, // max 10 files
		 
		 
		  ));
		?>
	</div>
	</div>


                        </div>   
  </div>

	<div class="form-actions" style="text-align:center">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
                        'icon'=>'ok white',  
			'label'=>$model->isNewRecord ? 'Tambah' : 'Simpan',
		)); ?>
              <?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'reset',
                        'icon'=>'remove',  
			'label'=>'Reset',
		)); ?>
	</div>
</fieldset>

<?php $this->endWidget(); ?>

</div>
